﻿public class Solution {
    public int FindContentChildren(int[] g, int[] s)
    {
        int count = 0;
        Array.Sort(g);
        Array.Sort(s);

        int gpoint = g.Length - 1;
        int spoint = s.Length - 1;

        while (gpoint >= 0 && spoint >= 0)
        {
            if (s[spoint] >= g[gpoint])
            {
                count++;
                spoint--;
                gpoint--;
            }
            else
            {
                gpoint--;
            }
        }

        return count;
    }

    public static void Main(string[] args)
    {
        int[] g = [1, 2], s = [1, 2, 3];
        Solution solution = new Solution();
        int num = solution.FindContentChildren(g, s);
        Console.WriteLine(num);
    }
}